ostree.git
4 years agoMerge pull request #2472 from lucab/ups/prepare-root-checked-printf
Jonathan Lebon [Tue, 26 Oct 2021 19:14:21 +0000 (15:14 -0400)]
Merge pull request #2472 from lucab/ups/prepare-root-checked-printf

4 years agoMerge pull request #2473 from lucab/ups/prepare-root-less-global-mutable-state
Jonathan Lebon [Tue, 26 Oct 2021 17:25:37 +0000 (13:25 -0400)]
Merge pull request #2473 from lucab/ups/prepare-root-less-global-mutable-state

4 years agoprepare-root: get rid of a global variable
Luca BRUNO [Tue, 26 Oct 2021 16:27:22 +0000 (16:27 +0000)]
prepare-root: get rid of a global variable

This moves a global mutable variable to a smaller local scope,
as it is not really used outside of that.

4 years agoprepare-root: check return codes for errors when assembling paths
Luca BRUNO [Tue, 26 Oct 2021 12:12:48 +0000 (12:12 +0000)]
prepare-root: check return codes for errors when assembling paths

This adds checks around all `snprintf` calls in order to detect
failures and gracefully abort.

4 years agoMerge pull request #2471 from lucab/ups/prepare-root-silent-mounts
Colin Walters [Tue, 26 Oct 2021 14:06:52 +0000 (10:06 -0400)]
Merge pull request #2471 from lucab/ups/prepare-root-silent-mounts

prepare-root: make all mount operations silent

4 years agoprepare-root: make all mount operations silent
Luca BRUNO [Tue, 26 Oct 2021 10:12:27 +0000 (10:12 +0000)]
prepare-root: make all mount operations silent

This adds a `MS_SILENT` flag to all `mount(2)` calls, reducing the
amount of kernel logs produced on each boot.
Those messages do not contain actionable details, and in the "mount
plus read-only remount" case they can easily become highly redundant.

4 years agoMerge pull request #2468 from lucab/ups/tests-var-mount
Luca Bruno [Tue, 19 Oct 2021 09:03:19 +0000 (09:03 +0000)]
Merge pull request #2468 from lucab/ups/tests-var-mount

tests/var-mount: tweak test setup

4 years agotests/var-mount: tweak test setup
Luca BRUNO [Tue, 19 Oct 2021 08:03:09 +0000 (08:03 +0000)]
tests/var-mount: tweak test setup

This reworks the var-mount destructive test in order to properly use
the datadir for the current stateroot instead of a duplicated one.
In turn, it ensures that the resulting `var.mount` after reboot is
correctly pointing to the same location which hosted `/var` on the
previous boot.

4 years agoMerge pull request #2466 from cgwalters/ci-fanalyzer
Luca Bruno [Mon, 18 Oct 2021 16:44:56 +0000 (16:44 +0000)]
Merge pull request #2466 from cgwalters/ci-fanalyzer

ci: Enable -fanalyzer

4 years agotests/rollsum: Use `g_malloc` not `malloc`
Colin Walters [Mon, 18 Oct 2021 15:44:44 +0000 (11:44 -0400)]
tests/rollsum: Use `g_malloc` not `malloc`

To pacify gcc's `-fanalyzer`.

4 years agoci: Enable -fanalyzer
Colin Walters [Thu, 14 Oct 2021 14:40:39 +0000 (10:40 -0400)]
ci: Enable -fanalyzer

Followup to https://github.com/ostreedev/ostree/pull/2463

One thing I noticed here is we lost usage of `build-check.sh`
which also invokes `clang`, which doesn't speak `-fanalyzer`
and would be broken by this if we try to enable `build-check.sh`
again.  But that can come later.

4 years agoMerge pull request #2455 from cgwalters/packit
Luca Bruno [Fri, 15 Oct 2021 07:47:28 +0000 (07:47 +0000)]
Merge pull request #2455 from cgwalters/packit

Attempt to update packit flow to build in COPR

4 years agoMerge pull request #2467 from cgwalters/bump-libglnx-20211014
Jonathan Lebon [Thu, 14 Oct 2021 19:33:33 +0000 (15:33 -0400)]
Merge pull request #2467 from cgwalters/bump-libglnx-20211014

4 years agolibglnx: Bump to ef502aabf7d3a0d37f9c4d228f870ac93404447b
Colin Walters [Thu, 14 Oct 2021 16:40:14 +0000 (12:40 -0400)]
libglnx: Bump to ef502aabf7d3a0d37f9c4d228f870ac93404447b

Various fixes there, including one for `gcc -fanalyzer`.

Update submodule: libglnx

4 years agoAttempt to update packit flow to build in COPR
Colin Walters [Tue, 5 Oct 2021 19:49:23 +0000 (15:49 -0400)]
Attempt to update packit flow to build in COPR

No idea if this will really work, but at least `packit srpm`
does work now.

4 years agoMerge pull request #2463 from cgwalters/fix-fanalyzer
Luca Bruno [Thu, 14 Oct 2021 08:30:25 +0000 (08:30 +0000)]
Merge pull request #2463 from cgwalters/fix-fanalyzer

Fix various mostly theoretical gcc `-fanalyzer` issues

4 years agovariantutil: Fix gcc `-fanalyzer` warnin
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
variantutil: Fix gcc `-fanalyzer` warnin

Add some not-NULL assertions for return values from glib,
and upgrade some `g_return_if_fail` to `g_assert`.

4 years agoutils: Fix unreachable `NULL` deref by adding assertion
Colin Walters [Fri, 8 Oct 2021 13:10:59 +0000 (09:10 -0400)]
utils: Fix unreachable `NULL` deref by adding assertion

Again this one is just in theory, but let's add an assertion.

4 years agostatic-delta: Fix probably not actually possible NULL deref
Colin Walters [Fri, 8 Oct 2021 13:07:41 +0000 (09:07 -0400)]
static-delta: Fix probably not actually possible NULL deref

Flagged by `gcc -fanalyzer`.  I didn't study this really deeply
but I think it's not actually reachable.  Anyways, let's catch
it on general principle.

4 years agofetcher/soup: Fix gcc `-fanalyzer` warning
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
fetcher/soup: Fix gcc `-fanalyzer` warning

In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`.  The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.

In practice, let's abort.

4 years agosysroot: Fix gcc `-fanalyzer` warning
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
sysroot: Fix gcc `-fanalyzer` warning

In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`.  The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.

In practice, let's abort.

4 years agodeployment: Fix gcc `-fanalyzer` warning
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
deployment: Fix gcc `-fanalyzer` warning

In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`.  The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.

In practice, let's abort.

4 years agoremote: Fix gcc `-fanalyzer` warning
Colin Walters [Fri, 8 Oct 2021 12:59:52 +0000 (08:59 -0400)]
remote: Fix gcc `-fanalyzer` warning

In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`.  The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.

In practice, let's abort.

4 years agoMerge pull request #2464 from lucab/ups/box-auto-txn
Colin Walters [Wed, 13 Oct 2021 21:08:25 +0000 (17:08 -0400)]
Merge pull request #2464 from lucab/ups/box-auto-txn

repo/private: move OstreeRepoAutoTransaction to a boxed type

4 years agoMerge pull request #2465 from travier/docfixes
Luca Bruno [Tue, 12 Oct 2021 09:49:39 +0000 (09:49 +0000)]
Merge pull request #2465 from travier/docfixes

docs: Do not convert -- & --- to en/em-dash

4 years agodocs: Do not convert -- & --- to en/em-dash
Timothée Ravier [Mon, 11 Oct 2021 10:29:21 +0000 (12:29 +0200)]
docs: Do not convert -- & --- to en/em-dash

'--' is frequently used for command line options and was thus
incorrectly rendered as a special en-dash symbol.

4 years agorepo/private: move OstreeRepoAutoTransaction to a boxed type
Luca BRUNO [Mon, 11 Oct 2021 06:52:25 +0000 (06:52 +0000)]
repo/private: move OstreeRepoAutoTransaction to a boxed type

This defines `OstreeRepoAutoTransaction` as a boxed type, in order
to support auto-generating bindings for it.
That first requires adding internal reference-counting to it, to
allow freely copying/freeing references to a single transaction guard.

4 years agoMerge pull request #2461 from lucab/ups/prepare-root-logging
Colin Walters [Thu, 7 Oct 2021 15:56:17 +0000 (11:56 -0400)]
Merge pull request #2461 from lucab/ups/prepare-root-logging

prepare-root: tweak log messages to clarify errors

4 years agoprepare-root: tweak log messages to clarify errors
Luca BRUNO [Thu, 7 Oct 2021 14:40:31 +0000 (14:40 +0000)]
prepare-root: tweak log messages to clarify errors

This rewords errors and log messages in the functions which take care
of preparing sysroot in initramfs.
Depending on the boot flow, it is possible to reach this logic
with a sysroot mounted (unexpectedly) as read-only.
In that case, let's clearly point out the problematic mountpoint.

4 years agoMerge pull request #2460 from cgwalters/gir-no-tls-interaction
Jonathan Lebon [Thu, 7 Oct 2021 08:24:07 +0000 (04:24 -0400)]
Merge pull request #2460 from cgwalters/gir-no-tls-interaction

4 years agoMerge pull request #2459 from smcv/test-commit-sign
Colin Walters [Wed, 6 Oct 2021 19:26:08 +0000 (15:26 -0400)]
Merge pull request #2459 from smcv/test-commit-sign

test-commit-sign.sh: Skip a unit test when running as an installed-test

4 years agoRemove OstreeTlsCertInteraction bits from introspection
Colin Walters [Wed, 6 Oct 2021 16:42:56 +0000 (12:42 -0400)]
Remove OstreeTlsCertInteraction bits from introspection

We filter out everything named `-private.h` from scanning,
which differs from the gtk-doc exclude.  Eventually this will
be solved when we switch to the new gir-based docs.

Came up in https://github.com/ostreedev/ostree-rs/pull/34#discussion_r723337772

4 years agoMerge pull request #2458 from ostreedev/release-2021.5
Colin Walters [Wed, 6 Oct 2021 13:33:29 +0000 (09:33 -0400)]
Merge pull request #2458 from ostreedev/release-2021.5

Release 2021.5

4 years agotest-commit-sign.sh: Skip a unit test when running as an installed-test
Simon McVittie [Tue, 5 Oct 2021 22:51:37 +0000 (23:51 +0100)]
test-commit-sign.sh: Skip a unit test when running as an installed-test

Signed-off-by: Simon McVittie <smcv@debian.org>
4 years agoconfigure: post-release version bump
Colin Walters [Tue, 5 Oct 2021 20:00:53 +0000 (16:00 -0400)]
configure: post-release version bump

4 years agoRelease 2021.5
Colin Walters [Tue, 5 Oct 2021 19:59:43 +0000 (15:59 -0400)]
Release 2021.5

4 years agoMerge pull request #2449 from cgwalters/mtree-from-commit
Jonathan Lebon [Tue, 5 Oct 2021 15:56:02 +0000 (11:56 -0400)]
Merge pull request #2449 from cgwalters/mtree-from-commit

4 years agoMerge pull request #2454 from lucab/ups/auto-txn-complete
Colin Walters [Tue, 5 Oct 2021 14:49:01 +0000 (10:49 -0400)]
Merge pull request #2454 from lucab/ups/auto-txn-complete

repo/private: allow committing/aborting through a transaction guard

4 years agorepo/private: allow committing/aborting through a transaction guard
Luca BRUNO [Fri, 1 Oct 2021 16:04:02 +0000 (16:04 +0000)]
repo/private: allow committing/aborting through a transaction guard

This enhances the auto-transaction logic, augmenting the scope of a
transaction guard.
It allows committing or aborting a transaction through its guard.
It also supports tracking the completion status of a transaction
guard, avoiding double commits/aborts, while retaining the auto-cleanup
logic.

4 years agoMerge pull request #2453 from cgwalters/etc-ignore-sockets
Jonathan Lebon [Mon, 4 Oct 2021 20:54:44 +0000 (16:54 -0400)]
Merge pull request #2453 from cgwalters/etc-ignore-sockets

4 years agodeploy: Ignore sockets, fifos in /etc during merge
Colin Walters [Thu, 30 Sep 2021 19:53:18 +0000 (15:53 -0400)]
deploy: Ignore sockets, fifos in /etc during merge

https://bugzilla.redhat.com/show_bug.cgi?id=1945274 is an issue where a privileged
kubernetes daemonset is writing a socket into `/etc`.  This makes ostree upgrades barf.

Now, they should clearly move it to `/run`.  However, one option is for us to
just ignore it instead of erroring out.  Some brief investigation shows that
e.g. `git add somesocket` is a silent no-op, which is an argument in favor of ignoring it.

Closes: https://github.com/ostreedev/ostree/issues/2446
4 years agolib: Add an API to construct a `MutableTree` from a commit
Colin Walters [Thu, 30 Sep 2021 17:21:15 +0000 (13:21 -0400)]
lib: Add an API to construct a `MutableTree` from a commit

This is nicer than having the caller parse the commit
object, or indirect via the `OstreeRepoFile*` object of the root.

Will be used in ostree-rs-ext around tar parsing.

4 years agoMerge pull request #2447 from cgwalters/sepolicy-for-commit
Colin Walters [Thu, 30 Sep 2021 21:25:30 +0000 (17:25 -0400)]
Merge pull request #2447 from cgwalters/sepolicy-for-commit

repo: Add an API to init `OstreeSePolicy` from commit directly

4 years agoMerge pull request #2451 from cgwalters/fsck-happy
Jonathan Lebon [Thu, 30 Sep 2021 20:33:47 +0000 (16:33 -0400)]
Merge pull request #2451 from cgwalters/fsck-happy

4 years agoMerge pull request #2450 from cgwalters/revdep-ext-ci
Jonathan Lebon [Thu, 30 Sep 2021 20:15:45 +0000 (16:15 -0400)]
Merge pull request #2450 from cgwalters/revdep-ext-ci

4 years agosepolicy: Add deprecation comment for `_get_path()`
Colin Walters [Thu, 30 Sep 2021 15:38:10 +0000 (11:38 -0400)]
sepolicy: Add deprecation comment for `_get_path()`

Came up in review
https://github.com/ostreedev/ostree/pull/2447#issuecomment-931428312

4 years agorepo: Add an API to init `OstreeSePolicy` from commit directly
Colin Walters [Tue, 28 Sep 2021 21:40:28 +0000 (17:40 -0400)]
repo: Add an API to init `OstreeSePolicy` from commit directly

This is part of `OstreeCommitModifier`, but I'm not using
that in some of the ostree-ext Rust code.

It just makes more sense as a direct policy API, where it should
have been in the first place.  There's already support for
setting a policy object on a commit modifier, so that's all the
old API needs to do now.

4 years agofsck: Print a success message
Colin Walters [Thu, 30 Sep 2021 18:09:22 +0000 (14:09 -0400)]
fsck: Print a success message

There's a general Unix philosophy that "silence is golden".
However, when one is explicitly invoking an error check it's nice
to see explicit success.

We already print various statistics, so ending with a happy
note has no extra cost.

4 years agotests: Use ostree-ext 0.3.0
Colin Walters [Thu, 30 Sep 2021 17:38:25 +0000 (13:38 -0400)]
tests: Use ostree-ext 0.3.0

This updates to the modern glib 0.14 and paves the way for
some reverse dependency testing by using ostree-ext's code.

4 years agoMerge pull request #2448 from cgwalters/fix-selinux-policy
Colin Walters [Thu, 30 Sep 2021 17:26:00 +0000 (13:26 -0400)]
Merge pull request #2448 from cgwalters/fix-selinux-policy

bin/commit: Fix --tree=tar with --selinux-policy

4 years agobin/commit: Fix --tree=tar with --selinux-policy
Colin Walters [Wed, 29 Sep 2021 13:03:24 +0000 (09:03 -0400)]
bin/commit: Fix --tree=tar with --selinux-policy

The logic for `--selinux-policy` ended up in the `--tree=dir`
path, but there's no reason for that.  Fix the imported
labeling with `--tree=tar`.  Prep for use with containers.

We had this bug because the previous logic was trying to avoid
duplicating the code for generic `--selinux-policy` and
the case of `--selinux-policy-from-base --tree=dir`.

It's a bit more code, but it's cleaner if we dis-entangle them.

4 years agoMerge pull request #2440 from cgwalters/unit-test-counting
Colin Walters [Mon, 13 Sep 2021 18:19:19 +0000 (14:19 -0400)]
Merge pull request #2440 from cgwalters/unit-test-counting

two small unit test patches

4 years agotests: Add new TAP APIs
Colin Walters [Fri, 10 Sep 2021 21:07:42 +0000 (17:07 -0400)]
tests: Add new TAP APIs

Having to touch a global test counter when adding tests is
a recipe for conflicts between PRs.

The TAP protocol allows *ending* with the expected number of
tests, so the best way to do this is to have an explicit
API like our `tap_ok` which bumps a counter, then end with `tap_end`.

I ported one test as a demo.

4 years agotests/pull-test: Avoid duplicating test numbers
Colin Walters [Fri, 10 Sep 2021 21:06:56 +0000 (17:06 -0400)]
tests/pull-test: Avoid duplicating test numbers

We do this in other places; avoids touching two numbers when
adding tests.  Let computers do the addition.

4 years agoMerge pull request #2438 from cgwalters/release-2021.4
Colin Walters [Thu, 9 Sep 2021 11:34:59 +0000 (07:34 -0400)]
Merge pull request #2438 from cgwalters/release-2021.4

Release 2021.4

4 years agoconfigure: post-release version bump
Colin Walters [Wed, 8 Sep 2021 18:01:17 +0000 (14:01 -0400)]
configure: post-release version bump

4 years agoRelease 2021.4
Colin Walters [Wed, 8 Sep 2021 18:00:12 +0000 (14:00 -0400)]
Release 2021.4

4 years agoMerge pull request #2434 from cgwalters/custom-remote
Colin Walters [Wed, 8 Sep 2021 13:27:26 +0000 (09:27 -0400)]
Merge pull request #2434 from cgwalters/custom-remote

Add support for "custom remotes"

4 years agoAdd support for "custom remotes"
Colin Walters [Tue, 7 Sep 2021 22:02:24 +0000 (18:02 -0400)]
Add support for "custom remotes"

This will be helpful for the "ostree native container" work in
https://github.com/ostreedev/ostree-rs-ext/

Basically in order to reuse GPG/signapi verification, we need
to support adding a remote, even though it can't be used via
`ostree pull`.  (At least, not until we merge ostree-rs-ext into ostree, but
 even then I think the principle stands)

4 years agoMerge pull request #2435 from RBuddel/fix-delta-files-resume-legacy-transaction
Luca Bruno [Wed, 8 Sep 2021 08:52:54 +0000 (08:52 +0000)]
Merge pull request #2435 from RBuddel/fix-delta-files-resume-legacy-transaction

repo-pull: legacy_transaction_resuming flag ignored

4 years agoMerge pull request #2430 from cgwalters/stabilize-staging
Luca Bruno [Wed, 8 Sep 2021 08:18:00 +0000 (08:18 +0000)]
Merge pull request #2430 from cgwalters/stabilize-staging

upgrade: Stabilize deployment staging

4 years agorepo-pull: legacy_transaction_resuming flag ignored
Buddelmann, Richard RB [Wed, 8 Sep 2021 06:41:05 +0000 (08:41 +0200)]
repo-pull: legacy_transaction_resuming flag ignored

for deltafiles the legacy_transaction_resuming flag is not used,
which will mark the commit as done, even if files are missing.
using already existing commitstate_is_partial function as fix

4 years agoupgrade: Stabilize deployment staging
Colin Walters [Thu, 2 Sep 2021 20:59:15 +0000 (16:59 -0400)]
upgrade: Stabilize deployment staging

We're waaay overdue for this, it's been the default
in rpm-ostree for years, and solves several important bugs
around not capturing `/etc` while things are running.

Also, `ostree admin upgrade --stage` (should) become idempotent.

Closes: https://github.com/ostreedev/ostree/issues/2389
4 years agoMerge pull request #2428 from lucab/ups/tests-selinux-basic
Colin Walters [Tue, 7 Sep 2021 19:07:59 +0000 (15:07 -0400)]
Merge pull request #2428 from lucab/ups/tests-selinux-basic

tests: fix bare mode unprivileged 'make check'

4 years agotests: skip a broken fsck case
Luca BRUNO [Mon, 30 Aug 2021 15:55:16 +0000 (15:55 +0000)]
tests: skip a broken fsck case

There are some existing issues around fsck in unprivileged bare mode,
so this test does not really work at the moment. Leaving it as a FIXME
for the moment.

4 years agotests/basic: avoid changing ownership
Luca BRUNO [Mon, 30 Aug 2021 14:11:43 +0000 (14:11 +0000)]
tests/basic: avoid changing ownership

This avoids possible issues when trying to chmod, tweaking
permissions instead.

4 years agotests/basic: Skip --no-xattrs if we have selinux
Colin Walters [Thu, 26 Aug 2021 16:47:00 +0000 (12:47 -0400)]
tests/basic: Skip --no-xattrs if we have selinux

It cannot work to use `--no-xattrs` when SELinux is enabled
because we get a `security.selinux` attribute on created files
regardless.  So just skip this test if true.

Also add some `ostree fsck`s in here which helped me debug
this.

4 years agolibtest: tweak selinux/relabel message
Luca BRUNO [Mon, 30 Aug 2021 14:10:05 +0000 (14:10 +0000)]
libtest: tweak selinux/relabel message

4 years agoMerge pull request #2340 from cgwalters/sign-verify-api
Colin Walters [Tue, 31 Aug 2021 12:04:21 +0000 (08:04 -0400)]
Merge pull request #2340 from cgwalters/sign-verify-api

Add an API to verify a commit signature explicitly

4 years agoAdd an API to verify a commit signature explicitly
Colin Walters [Mon, 12 Apr 2021 22:42:05 +0000 (18:42 -0400)]
Add an API to verify a commit signature explicitly

We have a bunch of APIs to do GPG verification of a commit,
but that doesn't generalize to signapi.  Further, they
require the caller to check the signature status explicitly
which seems like a trap.

This much higher level API works with both GPG and signapi.
The intention is to use this in things that are doing "external
pulls" like the ostree-ext tar import support.  There we will
get the commitmeta from the tarball and we want to verify it
at the same time we import the commit.

4 years agoMerge pull request #2426 from cgwalters/xattrs-bareuseronly-union
Luca Bruno [Fri, 27 Aug 2021 07:34:46 +0000 (07:34 +0000)]
Merge pull request #2426 from cgwalters/xattrs-bareuseronly-union

checkout: Also ignore xattrs for union in bare-user-only mode

4 years agoMerge pull request #2425 from cgwalters/hardlink-correct-errno
Luca Bruno [Fri, 27 Aug 2021 07:33:27 +0000 (07:33 +0000)]
Merge pull request #2425 from cgwalters/hardlink-correct-errno

checkout: Save errno when re-throwing

4 years agocheckout: Also ignore xattrs for union in bare-user-only mode
Colin Walters [Thu, 26 Aug 2021 19:25:52 +0000 (15:25 -0400)]
checkout: Also ignore xattrs for union in bare-user-only mode

Followup to PRs related to https://github.com/ostreedev/ostree/issues/2410

Since the test suite now covers this the test was failing on
a Fedora SELinux enabled host where we see `security.selinux`
even if not in the commit.

4 years agoMerge pull request #2424 from cgwalters/test-nonroot-ci
Colin Walters [Thu, 26 Aug 2021 21:25:59 +0000 (17:25 -0400)]
Merge pull request #2424 from cgwalters/test-nonroot-ci

ci: Run GH action CI build+test as non-root

4 years agoMerge pull request #2422 from cgwalters/allow-none-detached
Dan Nicholson [Thu, 26 Aug 2021 19:33:23 +0000 (13:33 -0600)]
Merge pull request #2422 from cgwalters/allow-none-detached

lib: Change read_commit_detached_metadata to be nullable

4 years agocheckout: Save errno when re-throwing
Colin Walters [Thu, 26 Aug 2021 19:16:37 +0000 (15:16 -0400)]
checkout: Save errno when re-throwing

I was seeing an `EPERM`  here which was confusing.
It turned out the real error was `EEXIST`.

Since we're referring to the original error, but we do a
lot of computation in the middle, we need to save errno.

4 years agoci: Run main GH action CI build+test as non-root
Colin Walters [Thu, 26 Aug 2021 13:53:56 +0000 (09:53 -0400)]
ci: Run main GH action CI build+test as non-root

This is really the standard best practice, matching how
e.g. dpkg/rpm work, as well as most local development
environments (including mine) with e.g. `toolbox`.

4 years agolib: Change read_commit_detached_metadata to be nullable
Colin Walters [Wed, 25 Aug 2021 19:18:43 +0000 (15:18 -0400)]
lib: Change read_commit_detached_metadata to be nullable

Hit this while working on some Rust code.

4 years agoMerge pull request #2421 from lucab/ups/auto-txn-fixes
Colin Walters [Wed, 25 Aug 2021 21:45:28 +0000 (17:45 -0400)]
Merge pull request #2421 from lucab/ups/auto-txn-fixes

lib: improve transactions auto-cleanup logic

4 years agolib: improve transactions auto-cleanup logic
Luca BRUNO [Wed, 25 Aug 2021 12:30:21 +0000 (12:30 +0000)]
lib: improve transactions auto-cleanup logic

This fixes some aspects of OstreeRepoAutoTransaction and re-aligns
it with the logic in flatpak. Specifically:
 * link to the underlying repo through refcounting
 * bridge internal errors to warning messages
 * verify the input pointer type

This is a preparation step before exposing this logic as a public API.

4 years agoMerge pull request #2418 from lucab/ups/lib-commit-xattrs
Luca Bruno [Tue, 24 Aug 2021 14:28:39 +0000 (14:28 +0000)]
Merge pull request #2418 from lucab/ups/lib-commit-xattrs

commit: automatically skip xattrs in bare-user-only mode

4 years agotests: update several bare-user-only checks
Luca BRUNO [Mon, 23 Aug 2021 09:46:22 +0000 (09:46 +0000)]
tests: update several bare-user-only checks

4 years agolib/commit: automatically skip xattrs in bare-user-only mode
Luca BRUNO [Mon, 23 Aug 2021 13:08:44 +0000 (13:08 +0000)]
lib/commit: automatically skip xattrs in bare-user-only mode

4 years agobuiltins/commit: set up relevant flags in bare-user-only mode
Luca BRUNO [Mon, 23 Aug 2021 13:08:53 +0000 (13:08 +0000)]
builtins/commit: set up relevant flags in bare-user-only mode

This detects bare-user-only mode and automatically enables a
commit modifier with relevant flags.

4 years agolib/diff: automatically skip xattrs in bare-user-only mode
Luca BRUNO [Mon, 23 Aug 2021 13:51:55 +0000 (13:51 +0000)]
lib/diff: automatically skip xattrs in bare-user-only mode

4 years agoMerge pull request #2419 from dbnicholson/gpg-list-keys
Luca Bruno [Tue, 24 Aug 2021 07:55:59 +0000 (07:55 +0000)]
Merge pull request #2419 from dbnicholson/gpg-list-keys

bin/remote: Rename list-gpg-keys to gpg-list-keys

4 years agobin/remote: Rename list-gpg-keys to gpg-list-keys
Dan Nicholson [Mon, 23 Aug 2021 17:09:24 +0000 (11:09 -0600)]
bin/remote: Rename list-gpg-keys to gpg-list-keys

As pointed out in the original review, `gpg-list-keys` fits better
alongside the existing `gpg-import`.

Changes were done with:

```
git grep -l list-gpg-keys | xargs sed -i 's/list-gpg-keys/gpg-list-keys/'
for src in $(git ls-files '*list-gpg-keys*'); do
  dst=${src/list-gpg-keys/gpg-list-keys}
  git mv "$src" "$dst"
done
```

4 years agoMerge pull request #2417 from lucab/ups/diff-repo-ignore-xattrs
Colin Walters [Mon, 23 Aug 2021 14:58:36 +0000 (10:58 -0400)]
Merge pull request #2417 from lucab/ups/diff-repo-ignore-xattrs

lib/diff: ignore xattrs if disabled on either repos

4 years agolib/diff: ignore xattrs if disabled on either repos
Luca BRUNO [Mon, 23 Aug 2021 12:39:02 +0000 (12:39 +0000)]
lib/diff: ignore xattrs if disabled on either repos

This fixes the logic to detect whether xattrs should be automatically
ignored when diffing.

4 years agoMerge pull request #2412 from lucab/ups/lib-commit-canonicalize
Colin Walters [Fri, 20 Aug 2021 19:12:21 +0000 (15:12 -0400)]
Merge pull request #2412 from lucab/ups/lib-commit-canonicalize

lib/commit: autofix permissions for bare-user-only

4 years agoMerge pull request #2401 from dbnicholson/gpg-key-info
Colin Walters [Fri, 20 Aug 2021 19:11:11 +0000 (15:11 -0400)]
Merge pull request #2401 from dbnicholson/gpg-key-info

Remote GPG key info

4 years agolib/commit: autofix permissions for bare-user-only
Luca BRUNO [Fri, 20 Aug 2021 10:58:24 +0000 (10:58 +0000)]
lib/commit: autofix permissions for bare-user-only

This tweaks commit logic to detect bare-user-only repositories and
canonicalize permissions automatically.

4 years agoMerge pull request #2415 from lucab/ups/checksum-canonical-perms
Luca Bruno [Thu, 19 Aug 2021 17:00:14 +0000 (17:00 +0000)]
Merge pull request #2415 from lucab/ups/checksum-canonical-perms

lib/checkout: use canonical permissions in bare-user-only mode

4 years agolib/repo/checkout: use canonical perms in bare-user-only mode
Luca BRUNO [Thu, 19 Aug 2021 14:07:19 +0000 (14:07 +0000)]
lib/repo/checkout: use canonical perms in bare-user-only mode

This automatically enables canonical permissions for checkouts in
bare-user-only mode.

4 years agolib/core/checksum: add flag to use canonical permissions
Luca BRUNO [Thu, 19 Aug 2021 13:50:21 +0000 (13:50 +0000)]
lib/core/checksum: add flag to use canonical permissions

This adds a new `OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS`
checksumming flag, which is needed in bare-user-only mode
to ignore local IDs.

4 years agoMerge pull request #2414 from lucab/ups/cli-commit-modifier-autoptr
Colin Walters [Wed, 18 Aug 2021 13:10:17 +0000 (09:10 -0400)]
Merge pull request #2414 from lucab/ups/cli-commit-modifier-autoptr

builtins/commit: move commit modifier to auto-cleanup

4 years agoMerge pull request #2411 from lucab/ups/cli-commit-errors
Colin Walters [Wed, 18 Aug 2021 11:59:12 +0000 (07:59 -0400)]
Merge pull request #2411 from lucab/ups/cli-commit-errors

builtins/commit: check for conflicting permissions options

4 years agobuiltins/commit: move commit modifier to auto-cleanup
Luca BRUNO [Wed, 18 Aug 2021 09:06:26 +0000 (09:06 +0000)]
builtins/commit: move commit modifier to auto-cleanup

This reduces the usage of goto cleanup logic by porting the commit
modifier pointer to autoptr.

4 years agobuiltins/commit: check for conflicting permissions options
Luca BRUNO [Tue, 17 Aug 2021 10:30:06 +0000 (10:30 +0000)]
builtins/commit: check for conflicting permissions options

This explicitly checks for commit command options asking for both
non-zero UID/GID and canonical permissions at the same time,
which are incompatible.

4 years agoMerge pull request #2409 from jlebon/pr/cov-fixes
Luca Bruno [Wed, 4 Aug 2021 06:13:37 +0000 (06:13 +0000)]
Merge pull request #2409 from jlebon/pr/cov-fixes

A couple of Coverity fixes